package com.housekeeping.housekeeping.order.service.impl;

import com.housekeeping.housekeeping.order.dao.impl.TradeDaoImpl;
import com.housekeeping.housekeeping.order.entity.OrderTrade;
import com.housekeeping.housekeeping.order.service.TradeDetailServ;
import com.housekeeping.housekeeping.order.utils.ResponseCode;
import com.housekeeping.housekeeping.order.utils.ResponseEntity;

import java.sql.SQLException;

public class TradeDetailServImpl implements TradeDetailServ {
    private TradeDaoImpl tradeDao = new TradeDaoImpl();

    @Override
    public ResponseEntity<OrderTrade> getTradeContent(String sid) throws SQLException {
        OrderTrade tradeContent = tradeDao.getTradeContent(sid);
        ResponseEntity<OrderTrade> entity = null;
        if (tradeContent != null) {
            entity = ResponseEntity.success(tradeContent);
        } else {
            entity = ResponseEntity.error(ResponseCode.TRADE_DATA_GET_ERROR);
        }
        return entity;
    }
}
